import java.util.*;
public class StructuredObject extends RenovationObject{

	
	private Set<RenovationObject>parts;
	public StructuredObject(){
		parts = new HashSet<RenovationObject>();
	}
	
	
	public void add(RenovationObject o){
		if(o == null){
			throw new NullPointerException();
		}
		parts.add(o);
	}
	
	public double getPrice(){
		double price=0;
		for(RenovationObject o:parts){
			price = price+o.getPrice();
		}
		return price;
	}
	
	public Map<String, Double> addMaterialReq(Map<String, Double> materials){
		if(materials == null){
			throw new NullPointerException();
		}
		for(RenovationObject o:parts){
			materials = o.addMaterialReq(materials);
		}
		return materials;
	}
}
